Load Data

dataset <- read.delim("raw_data/Figure5G.txt", stringsAsFactors = FALSE)

dataset$genotype <- gsub(" ", "", dataset$genotype )
dataset$genotype <- factor(dataset$genotype)
dataset$Experiment <- factor(rep(paste0("exp", 1:(length(dataset$genotype)/length(levels(dataset$genotype)))), each=length(unique(dataset$genotype))))

dataset$siRNA <-  factor(gsub(".*[T,1]\\+","",dataset$genotype))
dataset$genotype <-  factor(gsub("\\+.*","",dataset$genotype))

dataset$UID <- factor(paste(dataset$Experiment, dataset$genotype, dataset$siRNA))
dataset$GSID <- factor(paste(dataset$genotype, dataset$siRNA))

# wide format
kable(dataset, row.names = F)
genotype NT olaparib_30nM olaparib_300nM olaparib_3000nM Experiment siRNA UID GSID
WT 2250 2050 1655 1022 exp1 siCtrl exp1 WT siCtrl WT siCtrl
WT 1850 1600 1020 510 exp1 siBRCA1 exp1 WT siBRCA1 WT siBRCA1
YFP-ALC1 1926 1832 1676 1184 exp1 siCtrl exp1 YFP-ALC1 siCtrl YFP-ALC1 siCtrl
YFP-ALC1 1700 1480 1180 1008 exp1 siBRCA1 exp1 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1
WT 2140 1920 1456 1105 exp2 siCtrl exp2 WT siCtrl WT siCtrl
WT 1700 1460 910 560 exp2 siBRCA1 exp2 WT siBRCA1 WT siBRCA1
YFP-ALC1 1820 1790 1550 1223 exp2 siCtrl exp2 YFP-ALC1 siCtrl YFP-ALC1 siCtrl
YFP-ALC1 1640 1420 1202 950 exp2 siBRCA1 exp2 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1
WT 3249 2741 2518 1774 exp3 siCtrl exp3 WT siCtrl WT siCtrl
WT 4900 3680 2720 1776 exp3 siBRCA1 exp3 WT siBRCA1 WT siBRCA1
YFP-ALC1 4878 4872 3516 2984 exp3 siCtrl exp3 YFP-ALC1 siCtrl YFP-ALC1 siCtrl
YFP-ALC1 3602 3404 2560 2200 exp3 siBRCA1 exp3 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1
WT 1992 1688 1404 910 exp4 siCtrl exp4 WT siCtrl WT siCtrl
WT 1880 1728 820 524 exp4 siBRCA1 exp4 WT siBRCA1 WT siBRCA1
YFP-ALC1 1040 920 706 564 exp4 siCtrl exp4 YFP-ALC1 siCtrl YFP-ALC1 siCtrl
YFP-ALC1 452 392 300 245 exp4 siBRCA1 exp4 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1
WT 1960 1660 1510 820 exp5 siCtrl exp5 WT siCtrl WT siCtrl
WT 2066 1750 1011 556 exp5 siBRCA1 exp5 WT siBRCA1 WT siBRCA1
YFP-ALC1 1120 1012 856 632 exp5 siCtrl exp5 YFP-ALC1 siCtrl YFP-ALC1 siCtrl
YFP-ALC1 552 495 352 330 exp5 siBRCA1 exp5 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1
library(reshape2)
# reshape to long format
dataset <- melt(dataset, variable.name = "Treatment", value.name = "Counts")

dataset$genotype <- relevel(dataset$genotype, ref = "WT")
dataset$siRNA <- relevel(dataset$siRNA, ref = "siCtrl")
dataset$UID <- relevel(dataset$UID, ref = "exp1 WT siCtrl")

dataset$Olaparib <- gsub("NT","1",dataset$Treatment)
dataset$Olaparib <- gsub("olaparib_|nM","",dataset$Olaparib)
dataset$Olaparib <- log10(as.integer(dataset$Olaparib))




dataset$Offset <- NA
for(uid in levels(dataset$UID)){
        dataset$Offset[dataset$UID == uid] <- mean(dataset$Counts[dataset$UID == uid])
}

dataset$NormCounts <- dataset$Counts / dataset$Offset



dataset$Offset2 <- NA
for(gsid in levels(dataset$GSID)){
        dataset$Offset2[dataset$GSID == gsid] <- mean(dataset$NormCounts[dataset$GSID == gsid & dataset$Olaparib == 0])
}

dataset$NormCounts2 <- dataset$NormCounts / dataset$Offset2



# long format
kable(dataset, row.names = F)
genotype Experiment siRNA UID GSID Treatment Counts Olaparib Offset NormCounts Offset2 NormCounts2
WT exp1 siCtrl exp1 WT siCtrl WT siCtrl NT 2250 0.000000 1744.25 1.2899527 1.298748 0.9932276
WT exp1 siBRCA1 exp1 WT siBRCA1 WT siBRCA1 NT 1850 0.000000 1245.00 1.4859438 1.501467 0.9896610
YFP-ALC1 exp1 siCtrl exp1 YFP-ALC1 siCtrl YFP-ALC1 siCtrl NT 1926 0.000000 1654.50 1.1640979 1.206172 0.9651176
YFP-ALC1 exp1 siBRCA1 exp1 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 NT 1700 0.000000 1342.00 1.2667660 1.265728 1.0008201
WT exp2 siCtrl exp2 WT siCtrl WT siCtrl NT 2140 0.000000 1655.25 1.2928561 1.298748 0.9954631
WT exp2 siBRCA1 exp2 WT siBRCA1 WT siBRCA1 NT 1700 0.000000 1157.50 1.4686825 1.501467 0.9781647
YFP-ALC1 exp2 siCtrl exp2 YFP-ALC1 siCtrl YFP-ALC1 siCtrl NT 1820 0.000000 1595.75 1.1405295 1.206172 0.9455777
YFP-ALC1 exp2 siBRCA1 exp2 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 NT 1640 0.000000 1303.00 1.2586339 1.265728 0.9943953
WT exp3 siCtrl exp3 WT siCtrl WT siCtrl NT 3249 0.000000 2570.50 1.2639564 1.298748 0.9732112
WT exp3 siBRCA1 exp3 WT siBRCA1 WT siBRCA1 NT 4900 0.000000 3269.00 1.4989293 1.501467 0.9983096
YFP-ALC1 exp3 siCtrl exp3 YFP-ALC1 siCtrl YFP-ALC1 siCtrl NT 4878 0.000000 4062.50 1.2007385 1.206172 0.9954951
YFP-ALC1 exp3 siBRCA1 exp3 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 NT 3602 0.000000 2941.50 1.2245453 1.265728 0.9674633
WT exp4 siCtrl exp4 WT siCtrl WT siCtrl NT 1992 0.000000 1498.50 1.3293293 1.298748 1.0235465
WT exp4 siBRCA1 exp4 WT siBRCA1 WT siBRCA1 NT 1880 0.000000 1238.00 1.5185784 1.501467 1.0113961
YFP-ALC1 exp4 siCtrl exp4 YFP-ALC1 siCtrl YFP-ALC1 siCtrl NT 1040 0.000000 807.50 1.2879257 1.206172 1.0677794
YFP-ALC1 exp4 siBRCA1 exp4 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 NT 452 0.000000 347.25 1.3016559 1.265728 1.0283852
WT exp5 siCtrl exp5 WT siCtrl WT siCtrl NT 1960 0.000000 1487.50 1.3176471 1.298748 1.0145515
WT exp5 siBRCA1 exp5 WT siBRCA1 WT siBRCA1 NT 2066 0.000000 1345.75 1.5352034 1.501467 1.0224686
YFP-ALC1 exp5 siCtrl exp5 YFP-ALC1 siCtrl YFP-ALC1 siCtrl NT 1120 0.000000 905.00 1.2375691 1.206172 1.0260302
YFP-ALC1 exp5 siBRCA1 exp5 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 NT 552 0.000000 432.25 1.2770388 1.265728 1.0089362
WT exp1 siCtrl exp1 WT siCtrl WT siCtrl olaparib_30nM 2050 1.477121 1744.25 1.1752902 1.298748 0.9049407
WT exp1 siBRCA1 exp1 WT siBRCA1 WT siBRCA1 olaparib_30nM 1600 1.477121 1245.00 1.2851406 1.501467 0.8559230
YFP-ALC1 exp1 siCtrl exp1 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_30nM 1832 1.477121 1654.50 1.1072832 1.206172 0.9180142
YFP-ALC1 exp1 siBRCA1 exp1 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_30nM 1480 1.477121 1342.00 1.1028316 1.265728 0.8713022
WT exp2 siCtrl exp2 WT siCtrl WT siCtrl olaparib_30nM 1920 1.477121 1655.25 1.1599456 1.298748 0.8931258
WT exp2 siBRCA1 exp2 WT siBRCA1 WT siBRCA1 olaparib_30nM 1460 1.477121 1157.50 1.2613391 1.501467 0.8400709
YFP-ALC1 exp2 siCtrl exp2 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_30nM 1790 1.477121 1595.75 1.1217296 1.206172 0.9299913
YFP-ALC1 exp2 siBRCA1 exp2 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_30nM 1420 1.477121 1303.00 1.0897928 1.265728 0.8610008
WT exp3 siCtrl exp3 WT siCtrl WT siCtrl olaparib_30nM 2741 1.477121 2570.50 1.0663295 1.298748 0.8210440
WT exp3 siBRCA1 exp3 WT siBRCA1 WT siBRCA1 olaparib_30nM 3680 1.477121 3269.00 1.1257265 1.501467 0.7497509
YFP-ALC1 exp3 siCtrl exp3 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_30nM 4872 1.477121 4062.50 1.1992615 1.206172 0.9942706
YFP-ALC1 exp3 siBRCA1 exp3 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_30nM 3404 1.477121 2941.50 1.1572327 1.265728 0.9142823
WT exp4 siCtrl exp4 WT siCtrl WT siCtrl olaparib_30nM 1688 1.477121 1498.50 1.1264598 1.298748 0.8673426
WT exp4 siBRCA1 exp4 WT siBRCA1 WT siBRCA1 olaparib_30nM 1728 1.477121 1238.00 1.3957997 1.501467 0.9296237
YFP-ALC1 exp4 siCtrl exp4 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_30nM 920 1.477121 807.50 1.1393189 1.206172 0.9445740
YFP-ALC1 exp4 siBRCA1 exp4 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_30nM 392 1.477121 347.25 1.1288697 1.265728 0.8918739
WT exp5 siCtrl exp5 WT siCtrl WT siCtrl olaparib_30nM 1660 1.477121 1487.50 1.1159664 1.298748 0.8592630
WT exp5 siBRCA1 exp5 WT siBRCA1 WT siBRCA1 olaparib_30nM 1750 1.477121 1345.75 1.3003901 1.501467 0.8660794
YFP-ALC1 exp5 siCtrl exp5 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_30nM 1012 1.477121 905.00 1.1182320 1.206172 0.9270916
YFP-ALC1 exp5 siBRCA1 exp5 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_30nM 495 1.477121 432.25 1.1451706 1.265728 0.9047526
WT exp1 siCtrl exp1 WT siCtrl WT siCtrl olaparib_300nM 1655 2.477121 1744.25 0.9488319 1.298748 0.7305741
WT exp1 siBRCA1 exp1 WT siBRCA1 WT siBRCA1 olaparib_300nM 1020 2.477121 1245.00 0.8192771 1.501467 0.5456509
YFP-ALC1 exp1 siCtrl exp1 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_300nM 1676 2.477121 1654.50 1.0129949 1.206172 0.8398427
YFP-ALC1 exp1 siBRCA1 exp1 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_300nM 1180 2.477121 1342.00 0.8792846 1.265728 0.6946869
WT exp2 siCtrl exp2 WT siCtrl WT siCtrl olaparib_300nM 1456 2.477121 1655.25 0.8796254 1.298748 0.6772871
WT exp2 siBRCA1 exp2 WT siBRCA1 WT siBRCA1 olaparib_300nM 910 2.477121 1157.50 0.7861771 1.501467 0.5236058
YFP-ALC1 exp2 siCtrl exp2 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_300nM 1550 2.477121 1595.75 0.9713301 1.206172 0.8052997
YFP-ALC1 exp2 siBRCA1 exp2 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_300nM 1202 2.477121 1303.00 0.9224866 1.265728 0.7288190
WT exp3 siCtrl exp3 WT siCtrl WT siCtrl olaparib_300nM 2518 2.477121 2570.50 0.9795760 1.298748 0.7542462
WT exp3 siBRCA1 exp3 WT siBRCA1 WT siBRCA1 olaparib_300nM 2720 2.477121 3269.00 0.8320587 1.501467 0.5541637
YFP-ALC1 exp3 siCtrl exp3 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_300nM 3516 2.477121 4062.50 0.8654769 1.206172 0.7175401
YFP-ALC1 exp3 siBRCA1 exp3 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_300nM 2560 2.477121 2941.50 0.8703043 1.265728 0.6875919
WT exp4 siCtrl exp4 WT siCtrl WT siCtrl olaparib_300nM 1404 2.477121 1498.50 0.9369369 1.298748 0.7214153
WT exp4 siBRCA1 exp4 WT siBRCA1 WT siBRCA1 olaparib_300nM 820 2.477121 1238.00 0.6623586 1.501467 0.4411409
YFP-ALC1 exp4 siCtrl exp4 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_300nM 706 2.477121 807.50 0.8743034 1.206172 0.7248579
YFP-ALC1 exp4 siBRCA1 exp4 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_300nM 300 2.477121 347.25 0.8639309 1.265728 0.6825565
WT exp5 siCtrl exp5 WT siCtrl WT siCtrl olaparib_300nM 1510 2.477121 1487.50 1.0151261 1.298748 0.7816188
WT exp5 siBRCA1 exp5 WT siBRCA1 WT siBRCA1 olaparib_300nM 1011 2.477121 1345.75 0.7512539 1.501467 0.5003465
YFP-ALC1 exp5 siCtrl exp5 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_300nM 856 2.477121 905.00 0.9458564 1.206172 0.7841802
YFP-ALC1 exp5 siBRCA1 exp5 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_300nM 352 2.477121 432.25 0.8143436 1.265728 0.6433796
WT exp1 siCtrl exp1 WT siCtrl WT siCtrl olaparib_3000nM 1022 3.477121 1744.25 0.5859252 1.298748 0.4511461
WT exp1 siBRCA1 exp1 WT siBRCA1 WT siBRCA1 olaparib_3000nM 510 3.477121 1245.00 0.4096386 1.501467 0.2728255
YFP-ALC1 exp1 siCtrl exp1 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_3000nM 1184 3.477121 1654.50 0.7156241 1.206172 0.5933018
YFP-ALC1 exp1 siBRCA1 exp1 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_3000nM 1008 3.477121 1342.00 0.7511177 1.265728 0.5934275
WT exp2 siCtrl exp2 WT siCtrl WT siCtrl olaparib_3000nM 1105 3.477121 1655.25 0.6675729 1.298748 0.5140125
WT exp2 siBRCA1 exp2 WT siBRCA1 WT siBRCA1 olaparib_3000nM 560 3.477121 1157.50 0.4838013 1.501467 0.3222190
YFP-ALC1 exp2 siCtrl exp2 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_3000nM 1223 3.477121 1595.75 0.7664108 1.206172 0.6354075
YFP-ALC1 exp2 siBRCA1 exp2 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_3000nM 950 3.477121 1303.00 0.7290867 1.265728 0.5760217
WT exp3 siCtrl exp3 WT siCtrl WT siCtrl olaparib_3000nM 1774 3.477121 2570.50 0.6901381 1.298748 0.5313871
WT exp3 siBRCA1 exp3 WT siBRCA1 WT siBRCA1 olaparib_3000nM 1776 3.477121 3269.00 0.5432854 1.501467 0.3618363
YFP-ALC1 exp3 siCtrl exp3 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_3000nM 2984 3.477121 4062.50 0.7345231 1.206172 0.6089704
YFP-ALC1 exp3 siBRCA1 exp3 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_3000nM 2200 3.477121 2941.50 0.7479177 1.265728 0.5908993
WT exp4 siCtrl exp4 WT siCtrl WT siCtrl olaparib_3000nM 910 3.477121 1498.50 0.6072739 1.298748 0.4675840
WT exp4 siBRCA1 exp4 WT siBRCA1 WT siBRCA1 olaparib_3000nM 524 3.477121 1238.00 0.4232633 1.501467 0.2818998
YFP-ALC1 exp4 siCtrl exp4 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_3000nM 564 3.477121 807.50 0.6984520 1.206172 0.5790650
YFP-ALC1 exp4 siBRCA1 exp4 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_3000nM 245 3.477121 347.25 0.7055436 1.265728 0.5574212
WT exp5 siCtrl exp5 WT siCtrl WT siCtrl olaparib_3000nM 820 3.477121 1487.50 0.5512605 1.298748 0.4244552
WT exp5 siBRCA1 exp5 WT siBRCA1 WT siBRCA1 olaparib_3000nM 556 3.477121 1345.75 0.4131525 1.501467 0.2751658
YFP-ALC1 exp5 siCtrl exp5 YFP-ALC1 siCtrl YFP-ALC1 siCtrl olaparib_3000nM 632 3.477121 905.00 0.6983425 1.206172 0.5789742
YFP-ALC1 exp5 siBRCA1 exp5 YFP-ALC1 siBRCA1 YFP-ALC1 siBRCA1 olaparib_3000nM 330 3.477121 432.25 0.7634471 1.265728 0.6031684

Plot Data

library(ggplot2)

# raw data
ggplot(dataset, aes(x=Olaparib, y=Counts)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_smooth(method=lm, formula = y ~ poly(x,2), se=FALSE, aes(colour=siRNA)) +
        geom_point(aes(colour=siRNA, shape=Experiment), size=2) +        
        facet_grid(. ~ genotype) +
        xlab(label = "Olaparib (log10 nM)") +
        scale_shape_manual(values=15:20) +
        scale_color_manual(values=c("#000000","#FF0000"))

# NormCounts Linear
ggplot(dataset, aes(x=Olaparib, y=NormCounts, color=siRNA)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=siRNA), size=2) +        
        geom_smooth(method=lm, formula = y ~ x, se=FALSE) +
        facet_grid(. ~ genotype) +
        xlab(label = "Olaparib (log10 nM)") +
        scale_color_manual(values=c("#000000","#FF0000"))

# NormCounts2 Linear
ggplot(dataset, aes(x=Olaparib, y=NormCounts2, color=siRNA)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=siRNA), size=2) +        
        geom_smooth(method=lm, formula = y ~ x, se=FALSE) +
        facet_grid(. ~ genotype) +
        xlab(label = "Olaparib (log10 nM)") +
        scale_color_manual(values=c("#000000","#FF0000"))

# NormCounts Quadratic
ggplot(dataset, aes(x=Olaparib, y=NormCounts, color=siRNA)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=siRNA), size=2) +        
        geom_smooth(method=lm, formula = y ~ poly(x,2), se=FALSE) +
        facet_grid(. ~ genotype) +
        xlab(label = "Olaparib (log10 nM)")+
        scale_color_manual(values=c("#000000","#FF0000"))

# NormCounts2 Quadratic
ggplot(dataset, aes(x=Olaparib, y=NormCounts2, color=siRNA)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=siRNA), size=2) +        
        geom_smooth(method=lm, formula = y ~ poly(x,2), se=FALSE) +
        facet_grid(. ~ genotype) +
        xlab(label = "Olaparib (log10 nM)") +
        scale_color_manual(values=c("#000000","#FF0000"))

# NormCounts Cubic
ggplot(dataset, aes(x=Olaparib, y=NormCounts, color=siRNA)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=siRNA), size=2) +        
        geom_smooth(method=lm, formula = y ~ poly(x,3), se=FALSE) +
        facet_grid(. ~ genotype) +
        xlab(label = "Olaparib (log10 nM)")+
        scale_color_manual(values=c("#000000","#FF0000"))

# NormCounts2 Cubic
ggplot(dataset, aes(x=Olaparib, y=NormCounts2, color=siRNA)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=siRNA), size=2) +        
        geom_smooth(method=lm, formula = y ~ poly(x,3), se=FALSE) +
        facet_grid(. ~ genotype) +
        xlab(label = "Olaparib (log10 nM)") +
        scale_color_manual(values=c("#000000","#FF0000"))

library(Cairo)

cairo_pdf("Figure5G.pdf", width = 5, height = 4, family = "Arial")

ggplot(dataset, aes(x=Olaparib, y=NormCounts2)) + 
        theme_bw() +
        theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank(), 
              axis.line = element_line(colour = "black"), text = element_text(size=14),
              panel.border = element_blank(), panel.background = element_blank()) +
        geom_point(aes(colour = siRNA, shape = genotype), size=1.75) +
        geom_smooth(method=lm, formula = y ~ poly(x,3), se=TRUE, 
                    aes(group = GSID,colour = siRNA, linetype = genotype), fill='#DDDDDD', size=0.5) +
        #facet_grid(. ~ genotype) +
        xlab(label = "Olaparib (log10 nM)") +
        ylab(label = "Normalized Counts") +
        scale_color_manual(values=c("#000000","#FF0000")) +
        guides(linetype = guide_legend(override.aes= list(color = "#555555"))) 

dev.off()
## quartz_off_screen 
##                 2

Models

library(MASS)
library(DHARMa)
library(lme4)
library(lmerTest)
library(bbmle)

Linear formula

fit1 <- lm(Counts ~ Experiment + Olaparib*siRNA*genotype, data = dataset)
print(summary(fit1))
## 
## Call:
## lm(formula = Counts ~ Experiment + Olaparib * siRNA * genotype, 
##     data = dataset)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1060.56  -209.39    11.22   252.27  1391.68 
## 
## Coefficients:
##                                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             2274.08     195.20  11.650  < 2e-16 ***
## Experimentexp2                           -68.56     152.59  -0.449  0.65462    
## Experimentexp3                          1714.44     152.59  11.236  < 2e-16 ***
## Experimentexp4                          -523.62     152.59  -3.432  0.00102 ** 
## Experimentexp5                          -453.81     152.59  -2.974  0.00406 ** 
## Olaparib                                -331.87      75.12  -4.418 3.67e-05 ***
## siRNAsiBRCA1                             174.68     239.95   0.728  0.46913    
## genotypeYFP-ALC1                        -141.46     239.95  -0.590  0.55746    
## Olaparib:siRNAsiBRCA1                   -169.46     106.23  -1.595  0.11531    
## Olaparib:genotypeYFP-ALC1                 83.60     106.23   0.787  0.43406    
## siRNAsiBRCA1:genotypeYFP-ALC1           -809.17     339.35  -2.384  0.01990 *  
## Olaparib:siRNAsiBRCA1:genotypeYFP-ALC1   224.71     150.23   1.496  0.13935    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 431.6 on 68 degrees of freedom
## Multiple R-squared:  0.8508, Adjusted R-squared:  0.8267 
## F-statistic: 35.26 on 11 and 68 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit1))
## AIC:  1210.822
simres <- simulateResiduals(fittedModel = fit1)
plot(simres)

fit2 <- lm(NormCounts ~ Olaparib*siRNA*genotype, data = dataset)
print(summary(fit2))
## 
## Call:
## lm(formula = NormCounts ~ Olaparib * siRNA * genotype, data = dataset)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.14430 -0.05874 -0.01280  0.05396  0.27693 
## 
## Coefficients:
##                                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                             1.35130    0.03274  41.277  < 2e-16 ***
## Olaparib                               -0.18909    0.01449 -13.047  < 2e-16 ***
## siRNAsiBRCA1                            0.22874    0.04630   4.941 4.90e-06 ***
## genotypeYFP-ALC1                       -0.09095    0.04630  -1.964 0.053343 .  
## Olaparib:siRNAsiBRCA1                  -0.12312    0.02050  -6.007 7.04e-08 ***
## Olaparib:genotypeYFP-ALC1               0.04895    0.02050   2.388 0.019548 *  
## siRNAsiBRCA1:genotypeYFP-ALC1          -0.19542    0.06547  -2.985 0.003875 ** 
## Olaparib:siRNAsiBRCA1:genotypeYFP-ALC1  0.10519    0.02899   3.629 0.000529 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.08327 on 72 degrees of freedom
## Multiple R-squared:  0.9216, Adjusted R-squared:  0.914 
## F-statistic:   121 on 7 and 72 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit2))
## AIC:  -161.1043
simres <- simulateResiduals(fittedModel = fit2)
plot(simres)

fit3 <- lm(NormCounts2 ~ Olaparib*siRNA*genotype, data = dataset)
print(summary(fit3))
## 
## Call:
## lm(formula = NormCounts2 ~ Olaparib * siRNA * genotype, data = dataset)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.109758 -0.045560 -0.009451  0.041690  0.184443 
## 
## Coefficients:
##                                         Estimate Std. Error t value Pr(>|t|)
## (Intercept)                             1.040465   0.024147  43.088  < 2e-16
## Olaparib                               -0.145595   0.010690 -13.619  < 2e-16
## siRNAsiBRCA1                            0.011865   0.034149   0.347   0.7293
## genotypeYFP-ALC1                        0.004457   0.034149   0.131   0.8965
## Olaparib:siRNAsiBRCA1                  -0.062342   0.015119  -4.124 9.87e-05
## Olaparib:genotypeYFP-ALC1               0.029411   0.015119   1.945   0.0556
## siRNAsiBRCA1:genotypeYFP-ALC1          -0.034710   0.048295  -0.719   0.4746
## Olaparib:siRNAsiBRCA1:genotypeYFP-ALC1  0.053641   0.021381   2.509   0.0144
##                                           
## (Intercept)                            ***
## Olaparib                               ***
## siRNAsiBRCA1                              
## genotypeYFP-ALC1                          
## Olaparib:siRNAsiBRCA1                  ***
## Olaparib:genotypeYFP-ALC1              .  
## siRNAsiBRCA1:genotypeYFP-ALC1             
## Olaparib:siRNAsiBRCA1:genotypeYFP-ALC1 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06142 on 72 degrees of freedom
## Multiple R-squared:  0.9256, Adjusted R-squared:  0.9183 
## F-statistic: 127.9 on 7 and 72 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit3))
## AIC:  -209.7982
simres <- simulateResiduals(fittedModel = fit3)
plot(simres)

fit4 <- lmer(Counts ~ Olaparib*siRNA*genotype + (1|UID), data = dataset)
print(summary(fit4))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Counts ~ Olaparib * siRNA * genotype + (1 | UID)
##    Data: dataset
## 
## REML criterion at convergence: 1103.6
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.32607 -0.48408  0.07435  0.38216  2.72754 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  UID      (Intercept) 944134   971.7   
##  Residual              77744   278.8   
## Number of obs: 80, groups:  UID, 20
## 
## Fixed effects:
##                                        Estimate Std. Error      df t value
## (Intercept)                             2407.76     448.16   17.37   5.373
## Olaparib                                -331.87      48.53   56.00  -6.838
## siRNAsiBRCA1                             174.68     633.79   17.37   0.276
## genotypeYFP-ALC1                        -141.46     633.79   17.37  -0.223
## Olaparib:siRNAsiBRCA1                   -169.46      68.63   56.00  -2.469
## Olaparib:genotypeYFP-ALC1                 83.60      68.63   56.00   1.218
## siRNAsiBRCA1:genotypeYFP-ALC1           -809.17     896.31   17.37  -0.903
## Olaparib:siRNAsiBRCA1:genotypeYFP-ALC1   224.71      97.06   56.00   2.315
##                                        Pr(>|t|)    
## (Intercept)                            4.71e-05 ***
## Olaparib                               6.40e-09 ***
## siRNAsiBRCA1                             0.7861    
## genotypeYFP-ALC1                         0.8260    
## Olaparib:siRNAsiBRCA1                    0.0166 *  
## Olaparib:genotypeYFP-ALC1                0.2283    
## siRNAsiBRCA1:genotypeYFP-ALC1            0.3790    
## Olaparib:siRNAsiBRCA1:genotypeYFP-ALC1   0.0243 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Olaprb sRNAsBRCA1 gYFP-A Ol:RNABRCA1 O:YFP- sRNABRCA1:
## Olaparib    -0.201                                                       
## siRNAsBRCA1 -0.707  0.142                                                
## gntYFP-ALC1 -0.707  0.142  0.500                                         
## Ol:RNABRCA1  0.142 -0.707 -0.201     -0.101                              
## Ol:YFP-ALC1  0.142 -0.707 -0.101     -0.201  0.500                       
## sRNABRCA1:Y  0.500 -0.101 -0.707     -0.707  0.142       0.142           
## O:RNABRCA1: -0.101  0.500  0.142      0.142 -0.707      -0.707 -0.201
cat("AIC: ", AIC(fit4))
## AIC:  1123.559
simres <- simulateResiduals(fittedModel = fit4)
plot(simres)

Quadratic formula

fit5 <- lm(Counts ~ Experiment + poly(Olaparib,2)*siRNA*genotype, data = dataset)
print(summary(fit5))
## 
## Call:
## lm(formula = Counts ~ Experiment + poly(Olaparib, 2) * siRNA * 
##     genotype, data = dataset)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -946.66 -275.06   28.98  227.19 1267.54 
## 
## Coefficients:
##                                                  Estimate Std. Error t value
## (Intercept)                                       1657.51     137.15  12.085
## Experimentexp2                                     -68.56     153.34  -0.447
## Experimentexp3                                    1714.44     153.34  11.181
## Experimentexp4                                    -523.62     153.34  -3.415
## Experimentexp5                                    -453.81     153.34  -2.960
## poly(Olaparib, 2)1                               -3813.51     867.41  -4.396
## poly(Olaparib, 2)2                                -954.25     867.41  -1.100
## siRNAsiBRCA1                                      -140.15     137.15  -1.022
## genotypeYFP-ALC1                                    13.85     137.15   0.101
## poly(Olaparib, 2)1:siRNAsiBRCA1                  -1947.25    1226.70  -1.587
## poly(Olaparib, 2)2:siRNAsiBRCA1                    158.88    1226.70   0.130
## poly(Olaparib, 2)1:genotypeYFP-ALC1                960.61    1226.70   0.783
## poly(Olaparib, 2)2:genotypeYFP-ALC1                 18.02    1226.70   0.015
## siRNAsiBRCA1:genotypeYFP-ALC1                     -391.70     193.96  -2.020
## poly(Olaparib, 2)1:siRNAsiBRCA1:genotypeYFP-ALC1  2582.11    1734.82   1.488
## poly(Olaparib, 2)2:siRNAsiBRCA1:genotypeYFP-ALC1   476.17    1734.82   0.274
##                                                  Pr(>|t|)    
## (Intercept)                                       < 2e-16 ***
## Experimentexp2                                    0.65629    
## Experimentexp3                                    < 2e-16 ***
## Experimentexp4                                    0.00111 ** 
## Experimentexp5                                    0.00432 ** 
## poly(Olaparib, 2)1                               4.24e-05 ***
## poly(Olaparib, 2)2                                0.27540    
## siRNAsiBRCA1                                      0.31069    
## genotypeYFP-ALC1                                  0.91988    
## poly(Olaparib, 2)1:siRNAsiBRCA1                   0.11735    
## poly(Olaparib, 2)2:siRNAsiBRCA1                   0.89735    
## poly(Olaparib, 2)1:genotypeYFP-ALC1               0.43647    
## poly(Olaparib, 2)2:genotypeYFP-ALC1               0.98833    
## siRNAsiBRCA1:genotypeYFP-ALC1                     0.04763 *  
## poly(Olaparib, 2)1:siRNAsiBRCA1:genotypeYFP-ALC1  0.14156    
## poly(Olaparib, 2)2:siRNAsiBRCA1:genotypeYFP-ALC1  0.78460    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 433.7 on 64 degrees of freedom
## Multiple R-squared:  0.8582, Adjusted R-squared:  0.825 
## F-statistic: 25.83 on 15 and 64 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit5))
## AIC:  1214.757
simres <- simulateResiduals(fittedModel = fit5)
plot(simres)

fit6 <- lm(NormCounts ~ poly(Olaparib,2)*siRNA*genotype, data = dataset)
print(summary(fit6))
## 
## Call:
## lm(formula = NormCounts ~ poly(Olaparib, 2) * siRNA * genotype, 
##     data = dataset)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.197464 -0.031413  0.000256  0.029071  0.197247 
## 
## Coefficients:
##                                                    Estimate Std. Error t value
## (Intercept)                                       1.000e+00  1.392e-02  71.815
## poly(Olaparib, 2)1                               -2.173e+00  1.245e-01 -17.446
## poly(Olaparib, 2)2                               -5.550e-01  1.245e-01  -4.456
## siRNAsiBRCA1                                      2.245e-16  1.969e-02   0.000
## genotypeYFP-ALC1                                  3.394e-16  1.969e-02   0.000
## poly(Olaparib, 2)1:siRNAsiBRCA1                  -1.415e+00  1.761e-01  -8.032
## poly(Olaparib, 2)2:siRNAsiBRCA1                  -4.597e-02  1.761e-01  -0.261
## poly(Olaparib, 2)1:genotypeYFP-ALC1               5.625e-01  1.761e-01   3.194
## poly(Olaparib, 2)2:genotypeYFP-ALC1               6.544e-02  1.761e-01   0.372
## siRNAsiBRCA1:genotypeYFP-ALC1                    -4.411e-16  2.785e-02   0.000
## poly(Olaparib, 2)1:siRNAsiBRCA1:genotypeYFP-ALC1  1.209e+00  2.491e-01   4.852
## poly(Olaparib, 2)2:siRNAsiBRCA1:genotypeYFP-ALC1  3.531e-01  2.491e-01   1.417
##                                                  Pr(>|t|)    
## (Intercept)                                       < 2e-16 ***
## poly(Olaparib, 2)1                                < 2e-16 ***
## poly(Olaparib, 2)2                               3.20e-05 ***
## siRNAsiBRCA1                                      1.00000    
## genotypeYFP-ALC1                                  1.00000    
## poly(Olaparib, 2)1:siRNAsiBRCA1                  1.91e-11 ***
## poly(Olaparib, 2)2:siRNAsiBRCA1                   0.79491    
## poly(Olaparib, 2)1:genotypeYFP-ALC1               0.00213 ** 
## poly(Olaparib, 2)2:genotypeYFP-ALC1               0.71141    
## siRNAsiBRCA1:genotypeYFP-ALC1                     1.00000    
## poly(Olaparib, 2)1:siRNAsiBRCA1:genotypeYFP-ALC1 7.45e-06 ***
## poly(Olaparib, 2)2:siRNAsiBRCA1:genotypeYFP-ALC1  0.16094    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06227 on 68 degrees of freedom
## Multiple R-squared:  0.9586, Adjusted R-squared:  0.9519 
## F-statistic: 143.2 on 11 and 68 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit6))
## AIC:  -204.1673
simres <- simulateResiduals(fittedModel = fit6)
plot(simres)

fit7 <- lm(NormCounts2 ~ poly(Olaparib,2)*siRNA*genotype, data = dataset)
print(summary(fit7))
## 
## Call:
## lm(formula = NormCounts2 ~ poly(Olaparib, 2) * siRNA * genotype, 
##     data = dataset)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.131514 -0.023050  0.000168  0.022818  0.131370 
## 
## Coefficients:
##                                                  Estimate Std. Error t value
## (Intercept)                                       0.76997    0.01013  76.015
## poly(Olaparib, 2)1                               -1.67303    0.09060 -18.466
## poly(Olaparib, 2)2                               -0.42734    0.09060  -4.717
## siRNAsiBRCA1                                     -0.10396    0.01432  -7.257
## genotypeYFP-ALC1                                  0.05910    0.01432   4.125
## poly(Olaparib, 2)1:siRNAsiBRCA1                  -0.71637    0.12813  -5.591
## poly(Olaparib, 2)2:siRNAsiBRCA1                   0.02708    0.12813   0.211
## poly(Olaparib, 2)1:genotypeYFP-ALC1               0.33796    0.12813   2.638
## poly(Olaparib, 2)2:genotypeYFP-ALC1               0.02145    0.12813   0.167
## siRNAsiBRCA1:genotypeYFP-ALC1                     0.06495    0.02026   3.206
## poly(Olaparib, 2)1:siRNAsiBRCA1:genotypeYFP-ALC1  0.61639    0.18120   3.402
## poly(Olaparib, 2)2:siRNAsiBRCA1:genotypeYFP-ALC1  0.23463    0.18120   1.295
##                                                  Pr(>|t|)    
## (Intercept)                                       < 2e-16 ***
## poly(Olaparib, 2)1                                < 2e-16 ***
## poly(Olaparib, 2)2                               1.23e-05 ***
## siRNAsiBRCA1                                     4.87e-10 ***
## genotypeYFP-ALC1                                 0.000103 ***
## poly(Olaparib, 2)1:siRNAsiBRCA1                  4.34e-07 ***
## poly(Olaparib, 2)2:siRNAsiBRCA1                  0.833222    
## poly(Olaparib, 2)1:genotypeYFP-ALC1              0.010337 *  
## poly(Olaparib, 2)2:genotypeYFP-ALC1              0.867528    
## siRNAsiBRCA1:genotypeYFP-ALC1                    0.002052 ** 
## poly(Olaparib, 2)1:siRNAsiBRCA1:genotypeYFP-ALC1 0.001125 ** 
## poly(Olaparib, 2)2:siRNAsiBRCA1:genotypeYFP-ALC1 0.199729    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.0453 on 68 degrees of freedom
## Multiple R-squared:  0.9618, Adjusted R-squared:  0.9556 
## F-statistic: 155.5 on 11 and 68 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit7))
## AIC:  -255.0861
simres <- simulateResiduals(fittedModel = fit7)
plot(simres)

fit8 <- lmer(Counts ~ poly(Olaparib,2)*siRNA*genotype + (1|UID), data = dataset)
print(summary(fit8))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Counts ~ poly(Olaparib, 2) * siRNA * genotype + (1 | UID)
##    Data: dataset
## 
## REML criterion at convergence: 1017.8
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.07780 -0.36639 -0.01297  0.34311  3.02814 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  UID      (Intercept) 945657   972.4   
##  Residual              71655   267.7   
## Number of obs: 80, groups:  UID, 20
## 
## Fixed effects:
##                                                  Estimate Std. Error       df
## (Intercept)                                       1791.20     438.99    16.00
## poly(Olaparib, 2)1                               -3813.51     535.37    52.00
## poly(Olaparib, 2)2                                -954.25     535.37    52.00
## siRNAsiBRCA1                                      -140.15     620.83    16.00
## genotypeYFP-ALC1                                    13.85     620.83    16.00
## poly(Olaparib, 2)1:siRNAsiBRCA1                  -1947.25     757.13    52.00
## poly(Olaparib, 2)2:siRNAsiBRCA1                    158.88     757.13    52.00
## poly(Olaparib, 2)1:genotypeYFP-ALC1                960.61     757.13    52.00
## poly(Olaparib, 2)2:genotypeYFP-ALC1                 18.02     757.13    52.00
## siRNAsiBRCA1:genotypeYFP-ALC1                     -391.70     877.98    16.00
## poly(Olaparib, 2)1:siRNAsiBRCA1:genotypeYFP-ALC1  2582.11    1070.74    52.00
## poly(Olaparib, 2)2:siRNAsiBRCA1:genotypeYFP-ALC1   476.17    1070.74    52.00
##                                                  t value Pr(>|t|)    
## (Intercept)                                        4.080 0.000872 ***
## poly(Olaparib, 2)1                                -7.123 3.15e-09 ***
## poly(Olaparib, 2)2                                -1.782 0.080520 .  
## siRNAsiBRCA1                                      -0.226 0.824257    
## genotypeYFP-ALC1                                   0.022 0.982477    
## poly(Olaparib, 2)1:siRNAsiBRCA1                   -2.572 0.013012 *  
## poly(Olaparib, 2)2:siRNAsiBRCA1                    0.210 0.834608    
## poly(Olaparib, 2)1:genotypeYFP-ALC1                1.269 0.210179    
## poly(Olaparib, 2)2:genotypeYFP-ALC1                0.024 0.981108    
## siRNAsiBRCA1:genotypeYFP-ALC1                     -0.446 0.661478    
## poly(Olaparib, 2)1:siRNAsiBRCA1:genotypeYFP-ALC1   2.412 0.019453 *  
## poly(Olaparib, 2)2:siRNAsiBRCA1:genotypeYFP-ALC1   0.445 0.658373    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##                   (Intr) pl(O,2)1 pl(O,2)2 sRNAsBRCA1 gYFP-A pl(O,2)1:RNABRCA1
## ply(Olp,2)1        0.000                                                      
## ply(Olp,2)2        0.000  0.000                                               
## siRNAsBRCA1       -0.707  0.000    0.000                                      
## gntYFP-ALC1       -0.707  0.000    0.000    0.500                             
## pl(O,2)1:RNABRCA1  0.000 -0.707    0.000    0.000      0.000                  
## pl(O,2)2:RNABRCA1  0.000  0.000   -0.707    0.000      0.000  0.000           
## p(O,2)1:YFP        0.000 -0.707    0.000    0.000      0.000  0.500           
## p(O,2)2:YFP        0.000  0.000   -0.707    0.000      0.000  0.000           
## sRNABRCA1:Y        0.500  0.000    0.000   -0.707     -0.707  0.000           
## p(O,2)1:RNABRCA1:  0.000  0.500    0.000    0.000      0.000 -0.707           
## p(O,2)2:RNABRCA1:  0.000  0.000    0.500    0.000      0.000  0.000           
##                   pl(O,2)2:RNABRCA1 p(O,2)1:Y p(O,2)2:Y sRNABRCA1:
## ply(Olp,2)1                                                       
## ply(Olp,2)2                                                       
## siRNAsBRCA1                                                       
## gntYFP-ALC1                                                       
## pl(O,2)1:RNABRCA1                                                 
## pl(O,2)2:RNABRCA1                                                 
## p(O,2)1:YFP        0.000                                          
## p(O,2)2:YFP        0.500             0.000                        
## sRNABRCA1:Y        0.000             0.000     0.000              
## p(O,2)1:RNABRCA1:  0.000            -0.707     0.000     0.000    
## p(O,2)2:RNABRCA1: -0.707             0.000    -0.707     0.000    
##                   p(O,2)1:RNABRCA1:
## ply(Olp,2)1                        
## ply(Olp,2)2                        
## siRNAsBRCA1                        
## gntYFP-ALC1                        
## pl(O,2)1:RNABRCA1                  
## pl(O,2)2:RNABRCA1                  
## p(O,2)1:YFP                        
## p(O,2)2:YFP                        
## sRNABRCA1:Y                        
## p(O,2)1:RNABRCA1:                  
## p(O,2)2:RNABRCA1:  0.000
cat("AIC: ", AIC(fit8))
## AIC:  1045.844
simres <- simulateResiduals(fittedModel = fit8)
plot(simres)

Cubic formula

fit9 <- lm(Counts ~ Experiment + poly(Olaparib,3)*siRNA*genotype, data = dataset)
print(summary(fit9))
## 
## Call:
## lm(formula = Counts ~ Experiment + poly(Olaparib, 3) * siRNA * 
##     genotype, data = dataset)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -932.95 -192.29   42.57  237.90 1206.05 
## 
## Coefficients:
##                                                  Estimate Std. Error t value
## (Intercept)                                       1657.51     140.33  11.811
## Experimentexp2                                     -68.56     156.90  -0.437
## Experimentexp3                                    1714.44     156.90  10.927
## Experimentexp4                                    -523.62     156.90  -3.337
## Experimentexp5                                    -453.81     156.90  -2.892
## poly(Olaparib, 3)1                               -3813.51     887.54  -4.297
## poly(Olaparib, 3)2                                -954.25     887.54  -1.075
## poly(Olaparib, 3)3                                -235.30     887.54  -0.265
## siRNAsiBRCA1                                      -140.15     140.33  -0.999
## genotypeYFP-ALC1                                    13.85     140.33   0.099
## poly(Olaparib, 3)1:siRNAsiBRCA1                  -1947.25    1255.17  -1.551
## poly(Olaparib, 3)2:siRNAsiBRCA1                    158.88    1255.17   0.127
## poly(Olaparib, 3)3:siRNAsiBRCA1                    936.68    1255.17   0.746
## poly(Olaparib, 3)1:genotypeYFP-ALC1                960.61    1255.17   0.765
## poly(Olaparib, 3)2:genotypeYFP-ALC1                 18.02    1255.17   0.014
## poly(Olaparib, 3)3:genotypeYFP-ALC1                683.49    1255.17   0.545
## siRNAsiBRCA1:genotypeYFP-ALC1                     -391.70     198.46  -1.974
## poly(Olaparib, 3)1:siRNAsiBRCA1:genotypeYFP-ALC1  2582.11    1775.08   1.455
## poly(Olaparib, 3)2:siRNAsiBRCA1:genotypeYFP-ALC1   476.17    1775.08   0.268
## poly(Olaparib, 3)3:siRNAsiBRCA1:genotypeYFP-ALC1 -1008.92    1775.08  -0.568
##                                                  Pr(>|t|)    
## (Intercept)                                       < 2e-16 ***
## Experimentexp2                                    0.66369    
## Experimentexp3                                   6.69e-16 ***
## Experimentexp4                                    0.00146 ** 
## Experimentexp5                                    0.00532 ** 
## poly(Olaparib, 3)1                               6.45e-05 ***
## poly(Olaparib, 3)2                                0.28661    
## poly(Olaparib, 3)3                                0.79183    
## siRNAsiBRCA1                                      0.32195    
## genotypeYFP-ALC1                                  0.92171    
## poly(Olaparib, 3)1:siRNAsiBRCA1                   0.12607    
## poly(Olaparib, 3)2:siRNAsiBRCA1                   0.89970    
## poly(Olaparib, 3)3:siRNAsiBRCA1                   0.45843    
## poly(Olaparib, 3)1:genotypeYFP-ALC1               0.44708    
## poly(Olaparib, 3)2:genotypeYFP-ALC1               0.98860    
## poly(Olaparib, 3)3:genotypeYFP-ALC1               0.58809    
## siRNAsiBRCA1:genotypeYFP-ALC1                     0.05303 .  
## poly(Olaparib, 3)1:siRNAsiBRCA1:genotypeYFP-ALC1  0.15098    
## poly(Olaparib, 3)2:siRNAsiBRCA1:genotypeYFP-ALC1  0.78943    
## poly(Olaparib, 3)3:siRNAsiBRCA1:genotypeYFP-ALC1  0.57190    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 443.8 on 60 degrees of freedom
## Multiple R-squared:  0.8608, Adjusted R-squared:  0.8168 
## F-statistic: 19.53 on 19 and 60 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit9))
## AIC:  1221.265
simres <- simulateResiduals(fittedModel = fit9)
plot(simres)

fit10 <- lm(NormCounts ~ poly(Olaparib,3)*siRNA*genotype, data = dataset)
print(summary(fit10))
## 
## Call:
## lm(formula = NormCounts ~ poly(Olaparib, 3) * siRNA * genotype, 
##     data = dataset)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.147953 -0.025716 -0.002438  0.029525  0.122120 
## 
## Coefficients:
##                                                    Estimate Std. Error t value
## (Intercept)                                       1.000e+00  1.113e-02  89.848
## poly(Olaparib, 3)1                               -2.173e+00  9.955e-02 -21.827
## poly(Olaparib, 3)2                               -5.550e-01  9.955e-02  -5.575
## poly(Olaparib, 3)3                               -1.224e-01  9.955e-02  -1.229
## siRNAsiBRCA1                                      4.100e-16  1.574e-02   0.000
## genotypeYFP-ALC1                                  2.941e-16  1.574e-02   0.000
## poly(Olaparib, 3)1:siRNAsiBRCA1                  -1.415e+00  1.408e-01 -10.049
## poly(Olaparib, 3)2:siRNAsiBRCA1                  -4.597e-02  1.408e-01  -0.326
## poly(Olaparib, 3)3:siRNAsiBRCA1                   6.700e-01  1.408e-01   4.759
## poly(Olaparib, 3)1:genotypeYFP-ALC1               5.625e-01  1.408e-01   3.996
## poly(Olaparib, 3)2:genotypeYFP-ALC1               6.544e-02  1.408e-01   0.465
## poly(Olaparib, 3)3:genotypeYFP-ALC1               2.601e-01  1.408e-01   1.847
## siRNAsiBRCA1:genotypeYFP-ALC1                    -3.152e-16  2.226e-02   0.000
## poly(Olaparib, 3)1:siRNAsiBRCA1:genotypeYFP-ALC1  1.209e+00  1.991e-01   6.071
## poly(Olaparib, 3)2:siRNAsiBRCA1:genotypeYFP-ALC1  3.531e-01  1.991e-01   1.773
## poly(Olaparib, 3)3:siRNAsiBRCA1:genotypeYFP-ALC1 -5.132e-01  1.991e-01  -2.578
##                                                  Pr(>|t|)    
## (Intercept)                                       < 2e-16 ***
## poly(Olaparib, 3)1                                < 2e-16 ***
## poly(Olaparib, 3)2                               5.32e-07 ***
## poly(Olaparib, 3)3                               0.223550    
## siRNAsiBRCA1                                     1.000000    
## genotypeYFP-ALC1                                 1.000000    
## poly(Olaparib, 3)1:siRNAsiBRCA1                  8.69e-15 ***
## poly(Olaparib, 3)2:siRNAsiBRCA1                  0.745112    
## poly(Olaparib, 3)3:siRNAsiBRCA1                  1.15e-05 ***
## poly(Olaparib, 3)1:genotypeYFP-ALC1              0.000169 ***
## poly(Olaparib, 3)2:genotypeYFP-ALC1              0.643648    
## poly(Olaparib, 3)3:genotypeYFP-ALC1              0.069306 .  
## siRNAsiBRCA1:genotypeYFP-ALC1                    1.000000    
## poly(Olaparib, 3)1:siRNAsiBRCA1:genotypeYFP-ALC1 7.66e-08 ***
## poly(Olaparib, 3)2:siRNAsiBRCA1:genotypeYFP-ALC1 0.080940 .  
## poly(Olaparib, 3)3:siRNAsiBRCA1:genotypeYFP-ALC1 0.012260 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.04977 on 64 degrees of freedom
## Multiple R-squared:  0.9751, Adjusted R-squared:  0.9693 
## F-statistic: 167.2 on 15 and 64 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit10))
## AIC:  -236.8624
simres <- simulateResiduals(fittedModel = fit10)
plot(simres)

fit11 <- lm(NormCounts2 ~ poly(Olaparib,3)*siRNA*genotype, data = dataset)
print(summary(fit11))
## 
## Call:
## lm(formula = NormCounts2 ~ poly(Olaparib, 3) * siRNA * genotype, 
##     data = dataset)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.098539 -0.020350 -0.001746  0.021531  0.081334 
## 
## Coefficients:
##                                                   Estimate Std. Error t value
## (Intercept)                                       0.769972   0.008257  93.251
## poly(Olaparib, 3)1                               -1.673026   0.073853 -22.654
## poly(Olaparib, 3)2                               -0.427341   0.073853  -5.786
## poly(Olaparib, 3)3                               -0.094207   0.073853  -1.276
## siRNAsiBRCA1                                     -0.103957   0.011677  -8.903
## genotypeYFP-ALC1                                  0.059097   0.011677   5.061
## poly(Olaparib, 3)1:siRNAsiBRCA1                  -0.716369   0.104443  -6.859
## poly(Olaparib, 3)2:siRNAsiBRCA1                   0.027083   0.104443   0.259
## poly(Olaparib, 3)3:siRNAsiBRCA1                   0.458933   0.104443   4.394
## poly(Olaparib, 3)1:genotypeYFP-ALC1               0.337956   0.104443   3.236
## poly(Olaparib, 3)2:genotypeYFP-ALC1               0.021452   0.104443   0.205
## poly(Olaparib, 3)3:genotypeYFP-ALC1               0.208401   0.104443   1.995
## siRNAsiBRCA1:genotypeYFP-ALC1                     0.064947   0.016514   3.933
## poly(Olaparib, 3)1:siRNAsiBRCA1:genotypeYFP-ALC1  0.616391   0.147705   4.173
## poly(Olaparib, 3)2:siRNAsiBRCA1:genotypeYFP-ALC1  0.234634   0.147705   1.589
## poly(Olaparib, 3)3:siRNAsiBRCA1:genotypeYFP-ALC1 -0.340450   0.147705  -2.305
##                                                  Pr(>|t|)    
## (Intercept)                                       < 2e-16 ***
## poly(Olaparib, 3)1                                < 2e-16 ***
## poly(Olaparib, 3)2                               2.34e-07 ***
## poly(Olaparib, 3)3                               0.206705    
## siRNAsiBRCA1                                     8.37e-13 ***
## genotypeYFP-ALC1                                 3.77e-06 ***
## poly(Olaparib, 3)1:siRNAsiBRCA1                  3.29e-09 ***
## poly(Olaparib, 3)2:siRNAsiBRCA1                  0.796227    
## poly(Olaparib, 3)3:siRNAsiBRCA1                  4.27e-05 ***
## poly(Olaparib, 3)1:genotypeYFP-ALC1              0.001922 ** 
## poly(Olaparib, 3)2:genotypeYFP-ALC1              0.837915    
## poly(Olaparib, 3)3:genotypeYFP-ALC1              0.050266 .  
## siRNAsiBRCA1:genotypeYFP-ALC1                    0.000209 ***
## poly(Olaparib, 3)1:siRNAsiBRCA1:genotypeYFP-ALC1 9.24e-05 ***
## poly(Olaparib, 3)2:siRNAsiBRCA1:genotypeYFP-ALC1 0.117095    
## poly(Olaparib, 3)3:siRNAsiBRCA1:genotypeYFP-ALC1 0.024424 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03693 on 64 degrees of freedom
## Multiple R-squared:  0.9761, Adjusted R-squared:  0.9705 
## F-statistic: 174.2 on 15 and 64 DF,  p-value: < 2.2e-16
cat("AIC: ", AIC(fit11))
## AIC:  -284.6344
simres <- simulateResiduals(fittedModel = fit11)
plot(simres)

fit12 <- lmer(Counts ~ poly(Olaparib,3)*siRNA*genotype + (1|UID), data = dataset)
print(summary(fit12))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Counts ~ poly(Olaparib, 3) * siRNA * genotype + (1 | UID)
##    Data: dataset
## 
## REML criterion at convergence: 957.1
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.20787 -0.42360 -0.02922  0.33628  3.08502 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  UID      (Intercept) 945322   972.3   
##  Residual              72994   270.2   
## Number of obs: 80, groups:  UID, 20
## 
## Fixed effects:
##                                                  Estimate Std. Error       df
## (Intercept)                                       1791.20     438.99    16.00
## poly(Olaparib, 3)1                               -3813.51     540.35    48.00
## poly(Olaparib, 3)2                                -954.25     540.35    48.00
## poly(Olaparib, 3)3                                -235.30     540.35    48.00
## siRNAsiBRCA1                                      -140.15     620.83    16.00
## genotypeYFP-ALC1                                    13.85     620.83    16.00
## poly(Olaparib, 3)1:siRNAsiBRCA1                  -1947.25     764.17    48.00
## poly(Olaparib, 3)2:siRNAsiBRCA1                    158.88     764.17    48.00
## poly(Olaparib, 3)3:siRNAsiBRCA1                    936.68     764.17    48.00
## poly(Olaparib, 3)1:genotypeYFP-ALC1                960.61     764.17    48.00
## poly(Olaparib, 3)2:genotypeYFP-ALC1                 18.02     764.17    48.00
## poly(Olaparib, 3)3:genotypeYFP-ALC1                683.49     764.17    48.00
## siRNAsiBRCA1:genotypeYFP-ALC1                     -391.70     877.98    16.00
## poly(Olaparib, 3)1:siRNAsiBRCA1:genotypeYFP-ALC1  2582.11    1080.69    48.00
## poly(Olaparib, 3)2:siRNAsiBRCA1:genotypeYFP-ALC1   476.17    1080.69    48.00
## poly(Olaparib, 3)3:siRNAsiBRCA1:genotypeYFP-ALC1 -1008.92    1080.69    48.00
##                                                  t value Pr(>|t|)    
## (Intercept)                                        4.080 0.000872 ***
## poly(Olaparib, 3)1                                -7.058    6e-09 ***
## poly(Olaparib, 3)2                                -1.766 0.083756 .  
## poly(Olaparib, 3)3                                -0.435 0.665177    
## siRNAsiBRCA1                                      -0.226 0.824257    
## genotypeYFP-ALC1                                   0.022 0.982477    
## poly(Olaparib, 3)1:siRNAsiBRCA1                   -2.548 0.014083 *  
## poly(Olaparib, 3)2:siRNAsiBRCA1                    0.208 0.836177    
## poly(Olaparib, 3)3:siRNAsiBRCA1                    1.226 0.226271    
## poly(Olaparib, 3)1:genotypeYFP-ALC1                1.257 0.214811    
## poly(Olaparib, 3)2:genotypeYFP-ALC1                0.024 0.981289    
## poly(Olaparib, 3)3:genotypeYFP-ALC1                0.894 0.375558    
## siRNAsiBRCA1:genotypeYFP-ALC1                     -0.446 0.661478    
## poly(Olaparib, 3)1:siRNAsiBRCA1:genotypeYFP-ALC1   2.389 0.020858 *  
## poly(Olaparib, 3)2:siRNAsiBRCA1:genotypeYFP-ALC1   0.441 0.661469    
## poly(Olaparib, 3)3:siRNAsiBRCA1:genotypeYFP-ALC1  -0.934 0.355191    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
cat("AIC: ", AIC(fit12))
## AIC:  993.1168
simres <- simulateResiduals(fittedModel = fit12)
plot(simres)

Compare Results

ICtab(fit1,fit2,fit3,fit4,
      fit5,fit6,fit7,fit8,
      fit9,fit10,fit11,fit12,
      base=T)
##       AIC    dAIC   df
## fit11 -284.6    0.0 17
## fit7  -255.1   29.5 13
## fit10 -236.9   47.8 17
## fit3  -209.8   74.8 9 
## fit6  -204.2   80.5 13
## fit2  -161.1  123.5 9 
## fit12  993.1 1277.8 18
## fit8  1045.8 1330.5 14
## fit4  1123.6 1408.2 10
## fit1  1210.8 1495.5 13
## fit5  1214.8 1499.4 17
## fit9  1221.3 1505.9 21

Final Result

fit <- fit11

output <- coef(summary(fit))
output <- output[grep("Olaparib", rownames(output)),]

rownames(output) <- gsub("poly\\(|, [1-3]\\)","", rownames(output) )
rownames(output) <- gsub("genotype",  paste0(" ",levels(dataset$genotype)[1], " vs. "), rownames(output))
rownames(output)[!(grepl("vs", rownames(output)))] <- paste(rownames(output)[!(grepl("vs", rownames(output)))], levels(dataset$genotype)[1],  sep = " in " )

rownames(output) <- gsub("siRNA",  paste0(" ",levels(dataset$siRNA)[1], " vs. "), rownames(output))
rownames(output)[!(grepl("vs.*vs|in", rownames(output)))] <- paste(rownames(output)[!(grepl("vs.*vs|in", rownames(output)))], levels(dataset$siRNA)[1],  sep = " in " )

rownames(output)[!(grepl("vs", rownames(output)))] <- paste(rownames(output)[!(grepl("vs", rownames(output)))], levels(dataset$siRNA)[1],  sep = " " )


# suggested result table
kable(output, row.names = T)
Estimate Std. Error t value Pr(>|t|)
Olaparib1 in WT siCtrl -1.6730264 0.0738526 -22.6536025 0.0000000
Olaparib2 in WT siCtrl -0.4273414 0.0738526 -5.7864132 0.0000002
Olaparib3 in WT siCtrl -0.0942069 0.0738526 -1.2756078 0.2067048
Olaparib1: siCtrl vs. siBRCA1 in WT -0.7163693 0.1044433 -6.8589315 0.0000000
Olaparib2: siCtrl vs. siBRCA1 in WT 0.0270834 0.1044433 0.2593116 0.7962271
Olaparib3: siCtrl vs. siBRCA1 in WT 0.4589328 0.1044433 4.3940864 0.0000427
Olaparib1: WT vs. YFP-ALC1 in siCtrl 0.3379562 0.1044433 3.2357872 0.0019220
Olaparib2: WT vs. YFP-ALC1 in siCtrl 0.0214522 0.1044433 0.2053957 0.8379149
Olaparib3: WT vs. YFP-ALC1 in siCtrl 0.2084006 0.1044433 1.9953475 0.0502657
Olaparib1: siCtrl vs. siBRCA1: WT vs. YFP-ALC1 0.6163909 0.1477051 4.1731182 0.0000924
Olaparib2: siCtrl vs. siBRCA1: WT vs. YFP-ALC1 0.2346342 0.1477051 1.5885316 0.1170946
Olaparib3: siCtrl vs. siBRCA1: WT vs. YFP-ALC1 -0.3404500 0.1477051 -2.3049303 0.0244245
write.table(output, file = "Figure5G_Stats_Ref_WT_siCtrl.txt", quote = F, sep = "\t", row.names = T, col.names = NA)
# re-fit with siBRCA1 reference
dataset$siRNA <- relevel(dataset$siRNA, ref = "siBRCA1")
 
fit <- lm(NormCounts2 ~ poly(Olaparib,3)*siRNA*genotype, data = dataset)

output <- coef(summary(fit))
output <- output[grep("Olaparib", rownames(output)),]

rownames(output) <- gsub("poly\\(|, [1-3]\\)","", rownames(output) )
rownames(output) <- gsub("genotype",  paste0(" ",levels(dataset$genotype)[1], " vs. "), rownames(output))
rownames(output)[!(grepl("vs", rownames(output)))] <- paste(rownames(output)[!(grepl("vs", rownames(output)))], levels(dataset$genotype)[1],  sep = " in " )

rownames(output) <- gsub("siRNA",  paste0(" ",levels(dataset$siRNA)[1], " vs. "), rownames(output))
rownames(output)[!(grepl("vs.*vs|in", rownames(output)))] <- paste(rownames(output)[!(grepl("vs.*vs|in", rownames(output)))], levels(dataset$siRNA)[1],  sep = " in " )

rownames(output)[!(grepl("vs", rownames(output)))] <- paste(rownames(output)[!(grepl("vs", rownames(output)))], levels(dataset$siRNA)[1],  sep = " " )


# suggested result table
kable(output, row.names = T)
Estimate Std. Error t value Pr(>|t|)
Olaparib1 in WT siBRCA1 -2.3893957 0.0738526 -32.3535964 0.0000000
Olaparib2 in WT siBRCA1 -0.4002580 0.0738526 -5.4196913 0.0000010
Olaparib3 in WT siBRCA1 0.3647259 0.0738526 4.9385688 0.0000059
Olaparib1: siBRCA1 vs. siCtrl in WT 0.7163693 0.1044433 6.8589315 0.0000000
Olaparib2: siBRCA1 vs. siCtrl in WT -0.0270834 0.1044433 -0.2593116 0.7962271
Olaparib3: siBRCA1 vs. siCtrl in WT -0.4589328 0.1044433 -4.3940864 0.0000427
Olaparib1: WT vs. YFP-ALC1 in siBRCA1 0.9543471 0.1044433 9.1374676 0.0000000
Olaparib2: WT vs. YFP-ALC1 in siBRCA1 0.2560864 0.1044433 2.4519186 0.0169487
Olaparib3: WT vs. YFP-ALC1 in siBRCA1 -0.1320493 0.1044433 -1.2643162 0.2107017
Olaparib1: siBRCA1 vs. siCtrl: WT vs. YFP-ALC1 -0.6163909 0.1477051 -4.1731182 0.0000924
Olaparib2: siBRCA1 vs. siCtrl: WT vs. YFP-ALC1 -0.2346342 0.1477051 -1.5885316 0.1170946
Olaparib3: siBRCA1 vs. siCtrl: WT vs. YFP-ALC1 0.3404500 0.1477051 2.3049303 0.0244245
write.table(output, file = "Figure5G_Stats_Ref_WT_siBRCA1.txt", quote = F, sep = "\t", row.names = T, col.names = NA)

Anova

fit11a <- lm(NormCounts2 ~ poly(Olaparib,3)*siRNA*genotype, data = dataset)
fit11b <- lm(NormCounts2 ~ poly(Olaparib,3)*siRNA+genotype, data = dataset)

# anova table
anova(fit11a, fit11b)
## Analysis of Variance Table
## 
## Model 1: NormCounts2 ~ poly(Olaparib, 3) * siRNA * genotype
## Model 2: NormCounts2 ~ poly(Olaparib, 3) * siRNA + genotype
##   Res.Df      RSS Df Sum of Sq      F    Pr(>F)    
## 1     64 0.087267                                  
## 2     71 0.252346 -7  -0.16508 17.295 1.256e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit11c <- lm(NormCounts2 ~ poly(Olaparib,3)*genotype*siRNA, data = dataset)
fit11d <- lm(NormCounts2 ~ poly(Olaparib,3)*genotype+siRNA, data = dataset)

# anova table
anova(fit11c, fit11d)
## Analysis of Variance Table
## 
## Model 1: NormCounts2 ~ poly(Olaparib, 3) * genotype * siRNA
## Model 2: NormCounts2 ~ poly(Olaparib, 3) * genotype + siRNA
##   Res.Df      RSS Df Sum of Sq     F    Pr(>F)    
## 1     64 0.087267                                 
## 2     71 0.210491 -7  -0.12322 12.91 3.197e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1